<?php

function encrypt_openssl($msg, $key, $iv = null) {
	$iv_size = openssl_cipher_iv_length('AES-128-CBC');
	$encryptedMessage = openssl_encrypt($msg, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
	return bin2hex($encryptedMessage);
}
function decrypt_openssl($payload, $key, $iv) {
    $binary = hex2bin($payload);
	return openssl_decrypt($binary, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
}

$key = "fb9b3857531e0d89";
$iv = "0000000000000000"; // fixed value

// output da2e9df28673165000312dfb15f57517
echo encrypt_openssl('18812341234', $key, $iv);
echo "\n";
// output 18812341234
echo decrypt_openssl("da2e9df28673165000312dfb15f57517", $key, $iv);
